/*
 * @Des: 表单查询API
 * @Author: jin_yc
 * @Date: 2019-11-14 19:32:17
 * @LastEditor: jin_yc
 * @LastEditTime: 2020-08-27 19:09:05
 */
import request from '@/utils/request'


export function getReltasksAll(data) {
  return request({
    method: 'get',
    url: '/sys-bpm/relTasks/all',
    params: data
  })
}

export function getTaskNode(taskId) {
  return request({
    method: 'get',
    url: '/sys-bpm/process/taskKey',
    params: {
      taskId: taskId
    }
  })
}

// 
export function rejectFlow(params) {
  return request({
    url: '/sys-bpm/process/reject',
    method: 'PUT',
    params: params,
    data: JSON.stringify({}),
    transformRequest: [(data) => {
      return data
    }],
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * @description: 废弃流程
 * @path { taskId } 任务id 必填
 * @param { comment } 废弃原因
 */
export function processAbandon(taskId) {
  return request({
    method: 'delete',
    url: 'sys-bpm/process',
    params: {
      taskId
    }
  })
}
/**
 * @description: 获取流程评论
 * @param {data}
 */
export function getProcessHistory(params) {
  return request({
    method: 'get',
    url: '/sys-bpm/process/history',
    params: params
  })
}

/**
 * @description: 获取流程进行时的流程信息，用于展示流程图
 */
export function getHistoryNodes(params) {
  return request({
    method: 'get',
    url: '/sys-bpm/process/history/instance',
    params: params
  })
}

/**
 * @description: 获取流程图xml
 */
export function getModelXML(data) {
  return request({
    method: 'get',
    url: '/sys-bpm/model',
    params: {
      id: data.id,
      modelKey: data.modelKey,
      processInstanceId: data.processInstanceId,
    },
  })
}
/**
 * @description: 查询任务待办详情
 */
export function getUserTaskDetail(taskId) {
  return request({
    url: '/sys-bpm/userTask',
    method: 'get',
    params: {
      taskId: taskId
    }
  })
}